<div id="laypage-main"></div>
<script type="text/javascript">
layui.use(['laypage', 'layer'],function() {
    var laypage = layui.laypage,
    layer = layui.layer;
    var actname = '{$actname}';

    laypage({
        cont: $('#laypage-main'),
        pages: {$allpages},
        curr: function() {
            var page = "{$nowpage}"; // 当前页(后台获取到的)
            return page ? page: 1; // 返回当前页码值
        } (),
        jump: function(e, first) { //触发分页后的回调(单击页码后)
            if (!first) { //一定要加此判断，否则初始时会无限刷新
                var urls = "{:U('home/question/"+actname+"',array('page'=>'pageval'))}";
                var nowpage = e.curr; // (被单击的页码)
                urls = urls.replace('pageval', nowpage); // 替换链接样式和页码
                window.location.href = urls;
            }
        }
    });
});
</script>